/*KKzE5oaxlzRG0P1uDyB7rMpphkiIhTlRXnnBzrGMSwpQIV0VVe/FRuXeiIJnajzU*/
/**
 * Created by liqiankun on 2018/8/08.
 * 复选框群组件
 */


import React, {Component} from 'react';
import {high,base,ajax, deepClone, createPage, getMultiLang, getLangCode} from 'nc-lightapp-front';
import '../../css/searchModal/index.less';
import '../../../public/reportcss/searchmodalpage.less'
const {
    NCRow: Row, NCCol: Col, NCCheckbox: Checkbox
} = base;
import { FICheckbox } from '../../../public/components/base';
import {voucherHeightConfig} from '../../../export/pub/tinperNext/index.js';
import FormLabel from '../../../public/components/FormLabel';
class FourCheckBox extends Component{
    constructor(props){
        super(props);
        this.state = {
            json: {}
        }
    }
    componentWillMount() {
        let callback= (json) =>{
            this.setState({
                json:json
            },()=>{
                // initTemplate.call(this, this.props);
            })
        }
        getMultiLang({moduleId:'fourcheckbox',domainName:'gl',currentLocale:'simpchn',callback});
    }
    
    render(){
        let {renderCells, totalTitle, isInRow, needQuartering=true } = this.props; 
        let cellsLength = renderCells.length;
        if(cellsLength === 3) {
            needQuartering = false; //是否需要等分
        }
        let num = (needQuartering && cellsLength > 0) ?  24/cellsLength : 6;
        let langcode = getLangCode();
        let showTip = langcode == 'english' && cellsLength >= 3 ? true : (cellsLength <= 3 ? false : true);
        let wraperClassName = `includeVoucher ${isInRow ? '' : 'row-margin'}`;
        let wraperColconfig = isInRow ? voucherHeightConfig.allCol : voucherHeightConfig.twentyCol;
        return (
            <Row className={wraperClassName}> 
                {!isInRow &&
                    <Col {...voucherHeightConfig.fourCol} className='showattr gl-lineHeight-manageReport' style={{display: totalTitle ? '' : this.state.json['fourcheckbox-000000']}} >{/* 国际化处理： 显示属性：*/}
                        <FormLabel labelname={totalTitle} />
                    </Col>
                }
                <Col {...wraperColconfig} className='gl-lineHeight-manageReport'>
                {
                    renderCells.map((cell, index) => {
                        return <Col md={num} sm={num}>
                            <FICheckbox
                                key={index}
                                // id={cell.id}
                                showTip={showTip}
                                disabled={cell.disabled}
                                checked={cell.checked}
                                onChange={cell.onChange}
                            >
                            {cell.title}
                            </FICheckbox>
                        </Col>
                    })
                }
                </Col>
            </Row>
        )
    }
}


export default FourCheckBox

/*KKzE5oaxlzRG0P1uDyB7rMpphkiIhTlRXnnBzrGMSwpQIV0VVe/FRuXeiIJnajzU*/